package com.jolestar.yayaweibotong;



class YaYaOAuthToken implements java.io.Serializable {
	
	private String token;
    private String tokenSecret;
    String[] responseStr = null;
    
    public YaYaOAuthToken(String token, String tokenSecret) {
        this.token = token;
        this.tokenSecret = tokenSecret;
    }


    public String getToken() {
        return token;
    }

    public String getTokenSecret() {
        return tokenSecret;
    }


    public String getParameter(String parameter) {
    	String value = null;
        for (String str : responseStr) {
        	if (str.startsWith(parameter+'=')) {
        		value = str.split("=")[1].trim();
            	break;
            }
        }
        return value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof YaYaOAuthToken)) return false;

        YaYaOAuthToken that = (YaYaOAuthToken) o;

        if (!token.equals(that.token)) return false;
        if (!tokenSecret.equals(that.tokenSecret)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = token.hashCode();
        result = 31 * result + tokenSecret.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "OAuthToken{" +
                "token='" + token + '\'' +
                ", tokenSecret='" + tokenSecret + '\'' +
                '}';
    }
}
